package com.zryc.shop.pms.mapper;

import com.zryc.shop.cms.entity.PrefrenceAreaProductRelation;
import com.zryc.shop.cms.entity.SubjectProductRelation;
import com.zryc.shop.pms.entity.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 商品信息 Mapper 接口
 * </p>
 *
 * @author zhaozhao
 * @since 2024-01-18
 */
public interface ProductMapper extends BaseMapper<Product> {

    /**
     * 更新关联优选中间表
     *
     * @param productId
     * @param preferenceAreaId
     */
    void insertPreferenceAreaMid(@Param("productId") Long productId, @Param("prefrenceAreaId") Long preferenceAreaId);

    /**
     * 更新关联主题中间表
     *
     * @param productId
     * @param subjectId
     */
    void insertSubjectProductMid(@Param("productId") Long productId, @Param("subjectId") Long subjectId);

    List<PrefrenceAreaProductRelation> getPreferenceAreaMid(Long id);

    List<SubjectProductRelation> getSubjectProductMid(Long id);

    void removeFromPrefrence(Long id);

    void removeFromSubject(Long id);
}
